package com.intellekt.ecert.domain;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;

public class DemoUtils {

	public static String appelidoRandom() {

		Random r = new Random();

		int ran = r.nextInt(20);

		switch (ran) {
		case 0:
			return "Alvarez";
		case 1:
			return "Diaz";
		case 2:
			return "Gonzalez";
		case 3:
			return "Gutierrez";
		case 4:
			return "Hernandez";
		case 5:
			return "Henriquez";
		case 6:
			return "Hernandez";
		case 7:
			return "Lopez";
		case 8:
			return "Marquez";
		case 9:
			return "Martinez";
		case 10:
			return "Mendez";
		case 11:
			return "Nunez";
		case 12:
			return "Perez";
		case 13:
			return "Rodriguez";
		case 14:
			return "Ruiz";
		case 15:
			return "Sanchez";
		case 16:
			return "Suarez";
		case 17:
			return "Ortiz";
		case 18:
			return "Puyol";
		case 19:
			return "Marquez";
		default:
			return "Molina";
		}

	}

	public static String nombreRandom() {

		Random r = new Random();

		int ran = r.nextInt(20);

		switch (ran) {
		case 1:
			return "Alvaro";
		case 2:
			return "Diego";
		case 3:
			return "Gonzalo";
		case 4:
			return "Gutier";
		case 5:
			return "Fernando";
		case 6:
			return "Enrique";
		case 7:
			return "Bernando";
		case 8:
			return "Irene";
		case 9:
			return "Marco";
		case 10:
			return "Martin";
		case 11:
			return "Mendo";
		case 12:
			return "Nuno";
		case 13:
			return "Pedro";
		case 14:
			return "Rodrigo";
		case 15:
			return "Ronaldo";
		case 16:
			return "Sergio";
		case 17:
			return "Samuel";
		case 18:
			return "Raul";
		case 19:
			return "Javier";
		case 20:
			return "Alonso";
		default:
			return "Cuauhtemoc";
		}

	}

	public static String nombreCompleto() {

		return nombreRandom() + " " + appelidoRandom() + " " + appelidoRandom();
	}

	public static String valoresRandom(String valores[]) {
		int ran = 0;

		try {
			Random r = new Random();

			ran = r.nextInt(valores.length);

			return valores[ran];
		} catch (Exception e) {
			return "Error en el indice : " + ran;
		}
	}

	public static int numeroRandom() {
		try {
			Random r = new Random();
			int ran = 0;
			do {
				ran = r.nextInt(10);
				if (ran > 2) {
					return ran;
				}
			} while (true);
		} catch (Exception e) {
			e.printStackTrace();
			return 0;
		}
	}

	public static int numeroRandom(int param) {
		try {
			Random r = new Random();
			int ran = 0;
			do {
				ran = r.nextInt(param);
				if (ran > 0) {
					return ran;
				}
			} while (true);
		} catch (Exception e) {
			e.printStackTrace();
			return 0;
		}
	}

	public static Date fechaRandom() {
		try {
			Random r = new Random();
			int ran = 0;
			do {
				ran = r.nextInt(90);
				if (ran > 0) {
					Calendar c = Calendar.getInstance();
					c.add(Calendar.DAY_OF_YEAR, ran);

					return c.getTime();
				}
			} while (true);
		} catch (Exception e) {
			e.printStackTrace();
			return new Date();
		}
	}

	public static String fechaRandomStr() {
		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
		Date d = fechaRandom();
		return sdf.format(d);
	}

	public static String periodoRandomStr() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
		Date d = fechaRandom();
		return sdf.format(d);
	}

	public static Object adscripcionRandom() {
		Random r = new Random();

		int ran = r.nextInt(5);

		switch (ran) {
		case 1:
			return "Secretario particular de direccion general";
		default:
			return "Departamento de quejas y responsabilidades";

		}
	}

	public static Object nivelRandom() {
		Random r = new Random();

		int ran = r.nextInt(5);

		switch (ran) {
		case 1:
			return "PQ2";
		case 2:
			return "PQ1";
		case 3:
			return "NA1";
		default:
			return "PQ2";
		}
	}
	
	public static String booleanRandomStr() {
		int num = new Random().nextInt(2)+1;
		if(num==1)
			return "SI";
		else
			return "NO";
	}


}
